package com.sample.snl.frontend.LexicalAnalysis;

public class InRangeState extends State {

    Automaton automaton;

    public InRangeState(Automaton a) {
        this.automaton = a;
    }

    @Override
    void HandleCharacter(int ch) {
        if (automaton.isDigit(ch)) {
            automaton.unGetChar(ch);
            automaton.stringBuilder.deleteCharAt(automaton.stringBuilder.length() - 1);//吧多读入的数字删掉
            automaton.token = new Token(LexicalAnalyser.line, LexicalAnalyser.column, TokenType.UNDERRANGE, automaton.stringBuilder.toString());
            //LexicalAnalyser.LOG.debug("Recognized Token:" + automaton.token);
            automaton.gotToken = true;
            return;
        }
        automaton.setState(automaton.ErrorState);
    }
}
